import { executeInCurrentTab } from "~background/utils";;

const updateComments = (highlightId, viewstate, comments) => {

  function contentScriptUpdateComments(highlightId, viewstate, comments) {
    // window.highlighterAPI.highlights.deleteAll();
    if (window.top !== window.self) return; // JM：iframe调用检查
    window.highlighterAPI.highlightText.updateComments(highlightId, viewstate, comments);
  }

  executeInCurrentTab({ func: contentScriptUpdateComments, args: [highlightId, viewstate, comments] });
}

export default updateComments;
